//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;
using OpenLS.Vml.Serialization;

namespace OpenLS.Vml.Drawing
{
    internal class ColorMenu : IOfficeXmlSerializable
    {
        private Ext? _Ext;
        private string strokecolor;
        private string shadowcolor;
        private string fillcolor;
        private string extrusioncolor;

        public void ReadXml(ReadContext context)
        {
            using (var c = context.Read("colormenu"))
            {
                _Ext = c.GetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext");
                strokecolor = c.GetOptionalString("strokecolor");
                fillcolor = c.GetOptionalString("fillcolor");
                shadowcolor = c.GetOptionalString("shadowcolor");
                extrusioncolor = c.GetOptionalString("extrusioncolor");
            }
        }

        public void WriteXml(WriteContext context)
        {
            using (var c = context.Write("colormenu"))
            {
                c.SetOptionalEnum<Ext>(VmlConstants.VmlNamespace + "ext", _Ext);
                c.SetOptionalString("strokecolor", strokecolor);
                c.SetOptionalString("fillcolor", fillcolor);
                c.SetOptionalString("shadowcolor", shadowcolor);
                c.SetOptionalString("extrusioncolor", extrusioncolor);
            }
        }
    }
}